package com.ruoyi.buss.grid.sq.service.impl;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ruoyi.buss.customer.domain.DataCustomerInfo;
import com.ruoyi.buss.customer.domain.DataWgJtcy;
import com.ruoyi.buss.customer.mapper.DataCustomerInfoMapper;
import com.ruoyi.buss.customer.mapper.DataWgJtcyMapper;
import com.ruoyi.buss.grade.domain.DataCustomQuery;
import com.ruoyi.buss.grade.mapper.DataCustomQueryMapper;
import com.ruoyi.buss.grid.cj.domain.DataWgWgcj;
import com.ruoyi.buss.grid.sh.domain.DataGtgsh;
import com.ruoyi.buss.grid.sh.mapper.DataGtgshMapper;
import com.ruoyi.buss.grid.sq.domain.DataWgWgsq;
import com.ruoyi.buss.grid.sq.domain.DataWgWgsqSq;
import com.ruoyi.buss.grid.sq.domain.DataWgWgsqSqgl;
import com.ruoyi.buss.grid.sq.mapper.DataWgWgsqMapper;
import com.ruoyi.buss.grid.sq.service.IDataWgWgsqService;
import com.ruoyi.buss.group.domain.DataCustomerGroup;
import com.ruoyi.buss.group.domain.DataCustomerGroupRelation;
import com.ruoyi.buss.group.mapper.DataCustomerGroupRelationMapper;
import com.ruoyi.buss.task.domain.DataPlanTaskRelation;
import com.ruoyi.buss.task.domain.DataTaskInfo;
import com.ruoyi.buss.task.domain.DataUserTaskRelation;
import com.ruoyi.buss.task.mapper.DataPlanTaskRelationMapper;
import com.ruoyi.buss.task.mapper.DataUserTaskRelationMapper;
import com.ruoyi.buss.task.service.IDataTaskInfoService;
import com.ruoyi.buss.utils.CardUtil;
import com.ruoyi.buss.utils.DateUtilss;
import com.ruoyi.buss.utils.GetOnlyId;
import com.ruoyi.buss.utils.ListUtil;
import com.ruoyi.buss.utils.Params;
import com.ruoyi.buss.utils.PatternUtils;
import com.ruoyi.common.core.enums.ErrorCode;
import com.ruoyi.common.core.exception.CustomException;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.RemoteConfigService;
import com.ruoyi.system.api.model.LoginUser;

/**
 * 网格社区Service业务层处理
 * 
 * @author sxy
 * @date 2021-07-16
 */
@Service
public class DataWgWgsqServiceImpl implements IDataWgWgsqService 
{
    @Autowired
    private DataWgWgsqMapper dataWgWgsqMapper;
	@Autowired
    private DataUserTaskRelationMapper dataUserTaskRelationMapper;
    @Autowired
    private DataGtgshMapper dataGtgshMapper;

    @Autowired
    private RemoteConfigService remoteConfigService;

    @Autowired
    private DataWgJtcyMapper dataWgJtcyMapper;
    @Autowired
    private DataPlanTaskRelationMapper dataPlanTaskRelationMapper;
    @Autowired
    private DataCustomerGroupRelationMapper dataCustomerGroupRelationMapper;

    @Autowired
    private DataCustomerInfoMapper dataCustomerInfoMapper;

	@Autowired
	private DataCustomQueryMapper dataCustomQueryMapper;
	
	@Autowired
	private IDataTaskInfoService dataTaskInfoService;
	
	private ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30);
    /**
     * 查询网格社区列表
     *
     * @param dataWgWgsq 网格社区
     * @return 网格社区
     */
    @Override
    public List<DataWgWgsq> queryGridSqAll(DataWgWgsq dataWgWgsq, LoginUser userInfo) {

        if(userInfo.getRoles().contains("zhhz")){
            dataWgWgsq.setOrgId(userInfo.getSysUser().getDept().getOrgId());
        } else if(userInfo.getRoles().contains("common")){
            dataWgWgsq.setOrgId(userInfo.getSysUser().getDept().getOrgId());
            dataWgWgsq.setManagerId(userInfo.getSysUser().getUserName());
        }

        return dataWgWgsqMapper.selectDataWgWgsqList(dataWgWgsq);
    }

    /**
     * 查询网格社区客户列表
     * 
     * @param dataWgWgsq 网格社区
     * @return 网格社区
     */
    @Override
    public List<DataWgWgsq> selectDataWgWgsqList(DataWgWgsq dataWgWgsq,LoginUser userInfo)
    {
        AjaxResult result = remoteConfigService.selectConfigByKey(Params.IF_QUERY_GRIDSQ_ALL);
        String ifCheck = result.get("msg").toString();

        //如果是admin用户不做处理
        if(!"1".equals(ifCheck)){
            if(userInfo.getRoles().contains("zhhz")){
                dataWgWgsq.setOrgId(userInfo.getSysUser().getDept().getOrgId());
            } else if(userInfo.getRoles().contains("common")){
                dataWgWgsq.setOrgId(userInfo.getSysUser().getDept().getOrgId());
                dataWgWgsq.setManagerId(userInfo.getSysUser().getUserName());
            }
        }

        List<DataWgWgsq> doList = dataWgWgsqMapper.selectDataWgWgsqList(dataWgWgsq);

        for (DataWgWgsq custInfo : doList)
        {
            //获取群体
            List<DataCustomerGroup> groupLabel = custInfo.getGroupLabel();
            if (!ListUtil.isNullOrEmpty(groupLabel))
            {
                custInfo.setHeadPic(groupLabel.get(0).getGroupCode());
            } else {
                custInfo.setHeadPic(custInfo.getSex());
            }
        }

        return doList;
    }
    
    public AjaxResult deleteWgsq(DataWgWgsq dataWgWgsq) {
		try {
			DataWgWgsq dataWgWgsqVo = new DataWgWgsq();
			dataWgWgsqVo.setId(dataWgWgsq.getId());
			dataWgWgsqVo.setDelFlag("1");
			dataWgWgsqVo.setUpdateTime(DateUtils.getNowDate());
			dataWgWgsqMapper.updateDataWgWgsq(dataWgWgsqVo);
		} catch (RuntimeException e) {
        	e.printStackTrace();
        	throw new CustomException("删除网格村居成员信息异常！");
        }
		return AjaxResult.success();
	}
    
    
	public List<DataWgWgsq> selectSssqList() {
		List<DataWgWgsq> list = dataWgWgsqMapper.selectSssqList();
		return list;
	}
    
	public List<DataWgWgsqSq> wgsqAppBiYear(LoginUser userInfo) {

		String orgId = null;
		String userId = null;

		if (userInfo.getRoles().contains("zhhz")) {
			orgId = userInfo.getSysUser().getDept().getOrgId();

		} else if (userInfo.getRoles().contains("common")) {
			orgId = userInfo.getSysUser().getDept().getOrgId();
			userId = userInfo.getSysUser().getUserName();
		}
		Date date = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
		String twoYearAgo = DateUtilss.getLastYear(new Date(), -2);// 俩年前
		String ontYearAgo = DateUtilss.getLastYear(new Date(), -1);// 一年前
		String today = formatter.format(date).toString();
		List<DataWgWgsqSq> list = dataWgWgsqMapper.wgsqAppBiYear(twoYearAgo, ontYearAgo, today, orgId, userId);

		return list;
	}


	public List<DataWgWgsqSq> wgsqAppBiJd(LoginUser userInfo) {
		String orgId = null;
		String userId = null;

		if (userInfo.getRoles().contains("zhhz")) {
			orgId = userInfo.getSysUser().getDept().getOrgId();

		} else if (userInfo.getRoles().contains("common")) {
			orgId = userInfo.getSysUser().getDept().getOrgId();
			userId = userInfo.getSysUser().getUserName();
		}
		Date date = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
		String fjd = DateUtilss.getLastDay(new Date(), -9);// 4季度
		String sjd = DateUtilss.getLastDay(new Date(), -6);// 3季度
		String tjd = DateUtilss.getLastDay(new Date(), -4);// 2季度 二季度减四
		String today = formatter.format(date).toString();
		List<DataWgWgsqSq> list = dataWgWgsqMapper.wgsqAppBiJd(fjd, sjd, tjd, today, orgId, userId);
		return list;
	}


	public List<DataWgWgsqSq> wgsqAppBiMonth(LoginUser userInfo) {
		String orgId = null;
		String userId = null;

		if (userInfo.getRoles().contains("zhhz")) {
			orgId = userInfo.getSysUser().getDept().getOrgId();

		} else if (userInfo.getRoles().contains("common")) {
			orgId = userInfo.getSysUser().getDept().getOrgId();
			userId = userInfo.getSysUser().getUserName();
		}
		/**
		 * 获取今年内每个月最后一天
		 */
		ArrayList<String> sjrqs = DateUtilss.getEndMonthByYear(1, 0);

		List<DataWgWgsqSq> list = dataWgWgsqMapper.wgsqAppBiMonth(sjrqs, orgId, userId);
		return list;
	}
    
    
	/**
	 * 获取社区的小区或者社区
	 * type  1社区 2小区
	 */
	public List<DataWgWgsqSqgl> selectSqOrXq(DataWgWgsqSqgl vo, LoginUser userInfo) {
		
		String orgId = userInfo.getSysUser().getDept().getOrgId();
		List<DataWgWgsqSqgl> list = new ArrayList<>();
		 //不是管理员或总行的根据机构号查询
		if (userInfo.getRoles().contains("zhhz") || userInfo.getRoles().contains("common")) {
			vo.setOrgId(orgId);
        }
		//	 * type  1社区 2小区
		if ("1".equals(vo.getType())) {
			list = dataWgWgsqMapper.selectSq(vo);
		} else if ("2".equals(vo.getType())) {
			
			list = dataWgWgsqMapper.selectXq(vo);
		}
		return list;
	}
    
	public Map<String,Object> getKhInfo(DataWgWgsqSqgl vo,  LoginUser userInfo) {
		List<Map<String,String>> list = new ArrayList<>();
		Map<String,Object> map = new HashMap<>();
		//判断同一个小区是否包含该客户
		if(dataWgWgsqMapper.getIfSq(vo) >0 ) {
			map.put("type", "0");
			return map;
		}
		
		map.put("type", "1");
		//获取该客户的群体信息
		list = dataWgWgsqMapper.getGroupInfo(vo);
		if(list != null  &&  list.size() != 0) {
			map.put("value", list);
		}else {
			Map<String,String> maps = new HashMap<>();
			maps.put("khqt", "");
			list.add(maps);
			map.put("value", list);
		}
		return map;
	}
    
	public AjaxResult sqTask(DataWgWgsq dataWgWgsq, LoginUser userInfo) {
		
		String orgId = userInfo.getSysUser().getDept().getOrgId();
		String userId = userInfo.getSysUser().getUserName();

        if (userInfo.getRoles().contains("admin") || userInfo.getRoles().contains("office")) {
			
		} else if (userInfo.getRoles().contains("zhhz")) {
			dataWgWgsq.setOrgId(orgId);
		} else if (userInfo.getRoles().contains("common")) {
			dataWgWgsq.setOrgId(orgId);
			dataWgWgsq.setManagerId(userId);
		}else {
			return AjaxResult.error(ErrorCode.NoAuthorization);
		}

        long count = dataWgWgsqMapper.listByJgCount(dataWgWgsq);
        
        if (count == 0) {
			return AjaxResult.error(ErrorCode.NotQueryResult);
		}
		
		/**
		 * 先保存方案
		 */
	    String planCode = GetOnlyId.getOnlyId();
        DataCustomQuery dataCustomQuery = new DataCustomQuery();
        dataCustomQuery.setPlanCode(planCode);
        dataCustomQuery.setPlanName(dataWgWgsq.getPlanName());
        dataCustomQuery.setCreateUser(userId);
        dataCustomQuery.setCreateTime(DateUtils.getNowDate());
        dataCustomQueryMapper.insertDataCustomQuery(dataCustomQuery);

        // 插入条件 --跳过，app网格提交营销任务不需要条件
        // 插入方案
//        customQueryMapper.addPlan(customQueryVO);
        
        DataTaskInfo dataTaskInfo = new DataTaskInfo();        
        dataTaskInfo.setTaskType("1");
        dataTaskInfo.setIfGroup("0");
        dataTaskInfo.setGroupCode(planCode);
		if (dataWgWgsq.getBeginDate() != null && dataWgWgsq.getEndDate() != null) {
			dataTaskInfo.setBeginDate(DateUtilss.beginOfDate(dataWgWgsq.getBeginDate()));// 设置任务开始时间
			dataTaskInfo.setEndDate(DateUtilss.endOfDate(dataWgWgsq.getEndDate())); // 设置任务结束时间
		} else {
			dataTaskInfo.setBeginDate(DateUtilss.beginOfDate(new Date()));// 设置任务开始时间
			dataTaskInfo.setEndDate(DateUtilss.endOfDate(new Date())); // 设置任务结束时间
		}


		dataTaskInfo.setTaskName(dataWgWgsq.getPlanName());
		dataTaskInfo.setTaskTarget("CK,DK,ETC,XYK,SJYH,WY,DXQY,SDDJ,SYB,POS");

		Map<String,String> code = dataTaskInfoService.insertTask(dataTaskInfo,userInfo);
		 if( code.get("taskId")!=null ) {
        	/**
        	 * 另启一个线程池
        	 * 营销任务生成成功，则将查询方案和方案的客户进行关联
        	 * 需要设置DATA_PLAN_TASK_RELATION status为0  不加入定时任务自动关联方案与客户
        	 */
            fixedThreadPool.execute(() -> {
                try {
                    final List<DataWgWgsq> sqList = dataWgWgsqMapper.listSq(dataWgWgsq);
                    
                    String taskId = code.get("taskId");
                    DataPlanTaskRelation planTaskVO = new DataPlanTaskRelation();
                	planTaskVO.setPlanCode(planCode);
                	planTaskVO.setTaskId(taskId);

                	dataPlanTaskRelationMapper.updateDataPlanTaskRelation(planTaskVO);

                	
                	List<DataUserTaskRelation> relationList = new ArrayList<DataUserTaskRelation>();
                	//关联方案与客户信息
                	for (DataWgWgsq wgSq : sqList) {
                		String relationId = GetOnlyId.getOnlyId();
                		DataUserTaskRelation userTaskRelationVO = new DataUserTaskRelation();
                		userTaskRelationVO.setId(relationId);
    					userTaskRelationVO.setIdCard(wgSq.getIdCard());
    					userTaskRelationVO.setOrgId(wgSq.getOrgId());
    					userTaskRelationVO.setUserId(wgSq.getManagerId());
    					userTaskRelationVO.setCusName(wgSq.getName());
    					userTaskRelationVO.setTaskId(taskId);
    					userTaskRelationVO.setType("4");
    					userTaskRelationVO.setBeginDate(DateUtilss.beginOfDate(dataWgWgsq.getBeginDate()));
    					userTaskRelationVO.setEndDate(DateUtilss.endOfDate(dataWgWgsq.getEndDate()));
    					userTaskRelationVO.setStatus("1");
    					userTaskRelationVO.setComplete("0");
    					userTaskRelationVO.setCreateTime(DateUtils.getNowDate());
    					relationList.add(userTaskRelationVO);
    					if (relationList.size() == 1000) {
    						dataUserTaskRelationMapper.insertDataUserTaskRelationList(relationList);
    	                	relationList = new ArrayList<DataUserTaskRelation>();
    	                	//1000条数据提交一次
    					}
					}

					if (relationList.size() > 0) {
                		dataUserTaskRelationMapper.insertDataUserTaskRelationList(relationList);
	                	relationList = new ArrayList<DataUserTaskRelation>();
					}
                	
                	
                } catch (Exception e) {
                    e.printStackTrace();
                }
            });
        	
        }
		
		return AjaxResult.success();
	}
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    /**
     * 新增网格社区
     * 
     * @param dataWgWgsq 网格社区
     * @return 结果
     */
    @Override
    @Transactional
    public int insertDataWgWgsq(DataWgWgsq dataWgWgsq, LoginUser userInfo)
    {

        DataWgJtcy dataWgJtcy = new DataWgJtcy();

        dataWgWgsq.setCreateTime(DateUtils.getNowDate());

        //判断参数是否传入管户，如果未传，默认当前客户经理
        if(StringUtils.isEmpty(dataWgWgsq.getOrgId())
                || StringUtils.isEmpty(dataWgWgsq.getManagerId())){
            dataWgWgsq.setOrgId(userInfo.getSysUser().getDept().getOrgId());
            dataWgWgsq.setManagerId(userInfo.getSysUser().getUserName());
        }

        //先判断社区表中是否已存在该客户 不通小区可以重复
        List<DataWgWgsq> wgsq = dataWgWgsqMapper.selectDataWgWgsq(dataWgWgsq);
        if (!ListUtil.isNullOrEmpty(wgsq)){
            throw new CustomException("客户信息已存在");
        }

        //判断当前证件是否为身份证
        Boolean bool = PatternUtils.isIDNumber(dataWgWgsq.getIdCard());
        Map<String, Object> map = new HashMap<>();
        if (bool){
            //根据身份证获取性别与年龄
            if(dataWgWgsq.getIdCard().length() == 15 ){
                map =  CardUtil.getCarInfo15W(dataWgWgsq.getIdCard());
            } else {
                map = CardUtil.getCarInfo(dataWgWgsq.getIdCard());
            }
            dataWgWgsq.setAge(Integer.parseInt(map.get("age").toString()));
            dataWgWgsq.setSex(map.get("sex").toString());
        } else {
            dataWgWgsq.setSex("1");//默认性别
            dataWgWgsq.setAge(0);//默认年龄
        }

        //判断是否传入户籍编号与户主姓名，如果不存在，则初始化
        if(StringUtils.isEmpty(dataWgWgsq.getHjbh())
                && StringUtils.isEmpty(dataWgWgsq.getHzxm())){
            dataWgWgsq.setHjbh(dataWgWgsq.getIdCard());
            dataWgWgsq.setHzxm(dataWgWgsq.getName());
        }

        //初始化 与户主关系
        if(StringUtils.isEmpty(dataWgWgsq.getYhzgx())) {
            dataWgWgsq.setYhzgx("1");//客户默认户主
        }

        /**
         * 查询家庭成员信息
         * 如果没有家庭成员，则初始化家庭成员
         */
        List<DataWgJtcy> jtcyList = dataWgJtcyMapper.queryJtcy(dataWgWgsq.getIdCard());
        if (ListUtil.isNullOrEmpty(jtcyList)){
            dataWgJtcy.setHjbh(dataWgWgsq.getIdCard());
            dataWgJtcy.setHzxm(dataWgWgsq.getName());
            dataWgJtcy.setIdCard(dataWgWgsq.getIdCard());
            dataWgJtcy.setName(dataWgWgsq.getName());
            dataWgJtcy.setSex(dataWgWgsq.getSex());
            dataWgJtcy.setYhzgx(dataWgWgsq.getYhzgx());
            dataWgJtcy.setDelFlag("0");
            dataWgJtcyMapper.insertDataWgJtcy(dataWgJtcy);
        }

        /**
         * 判断群体信息是否存在，如果存在则跳过，不存在则新增
         */
        List<DataCustomerGroup> groupLabel = dataWgWgsq.getGroupLabel();
        for (DataCustomerGroup dataCustomerGroup : groupLabel){
            DataCustomerGroupRelation dataCustomerGroupRelation = new DataCustomerGroupRelation();
            dataCustomerGroupRelation.setIdCard(dataWgWgsq.getIdCard());
            dataCustomerGroupRelation.setKhqt(dataCustomerGroup.getGroupCode());

            //根据身份证和群体查询 客户群体信息是否存在
            DataCustomerGroupRelation groupRelation =
                    dataCustomerGroupRelationMapper.selectDataCustomerGroupRelationByGroup(dataCustomerGroupRelation);

            if (groupRelation != null){
                continue;
            } else {
                //补齐客户群体基础信息
                dataCustomerGroupRelation.setCreateTime(DateUtils.getNowDate());
                dataCustomerGroupRelation.setStatus("1");
                dataCustomerGroupRelation.setOrgId(dataWgWgsq.getOrgId());
                dataCustomerGroupRelation.setUserId(dataWgWgsq.getManagerId());
                dataCustomerGroupRelation.setCusName(dataWgWgsq.getName());
                dataCustomerGroupRelationMapper.insertDataCustomerGroupRelation(dataCustomerGroupRelation);
            }
        }

        //插入社区表
        int wgFlag = dataWgWgsqMapper.insertDataWgWgsq(dataWgWgsq);

        int flag = 0 ;
        if(wgFlag > 0){
            DataGtgsh dataGtgsh = new DataGtgsh();
            if(!ListUtil.isNullOrEmpty(dataWgWgsq.getDataGtgsh())){
                dataGtgsh = dataWgWgsq.getDataGtgsh().get(0);
                if(StringUtils.isEmpty(dataGtgsh.getZjhm())){
                    dataGtgsh.setId(GetOnlyId.getOnlyId());
                } else {
                    dataGtgsh.setId(dataGtgsh.getZjhm());
                }
                dataGtgsh.setSssjsq(dataWgWgsq.getSssjsq());
                dataGtgsh.setSssq(dataWgWgsq.getSssq());
                dataGtgsh.setOrgId(dataWgWgsq.getOrgId());
                dataGtgsh.setUserId(dataWgWgsq.getManagerId());
                dataGtgsh.setCreateTime(DateUtils.getNowDate());
                dataGtgsh.setCreateUser(dataWgWgsq.getManagerId());
                //插入个体工商户表
                flag = dataGtgshMapper.insertDataGtgsh(dataGtgsh);
            } else {
                flag = 1 ;
            }
        }

        /**
         * 判断存量客户信息表中是否存在，如果不存在，则插入
         */
        DataCustomerInfo dataCustomerInfo = dataCustomerInfoMapper.selectDataCustomerInfoByIdCard(dataWgWgsq.getIdCard());
        if (dataCustomerInfo == null){
            dataCustomerInfo = new DataCustomerInfo();
            dataCustomerInfo.setId(dataWgWgsq.getIdCard());
            dataCustomerInfo.setName(dataWgWgsq.getName());
            dataCustomerInfo.setIdCard(dataWgWgsq.getIdCard());
            dataCustomerInfo.setSex(dataWgWgsq.getSex());
            dataCustomerInfo.setAge(dataWgWgsq.getAge());
            dataCustomerInfo.setPhone(dataWgWgsq.getPhone());
            dataCustomerInfo.setAddress(dataWgWgsq.getAddress());
            dataCustomerInfo.setCustomerType(dataWgWgsq.getCustomerType());
            dataCustomerInfo.setCreateTime(DateUtils.getNowDate());
            dataCustomerInfo.setStatus("1");
            dataCustomerInfo.setIfFenpei("0");
            dataCustomerInfo.setIsPublic("0");
            dataCustomerInfo.setCustomerLevelZh("0");
            dataCustomerInfo.setOrgId(dataWgWgsq.getOrgId());
            dataCustomerInfo.setUserId(dataWgWgsq.getManagerId());
            if(dataWgWgsq.getIdCard().length() == 18){
                dataCustomerInfo.setBirthday(dataWgWgsq.getIdCard().substring(10,14));
            }
            dataCustomerInfoMapper.insertDataCustomerInfo(dataCustomerInfo);
        }

        return flag;
    }

    /**
     * 修改网格社区
     * 
     * @param dataWgWgsq 网格社区
     * @return 结果
     */
    @Override
    public int updateDataWgWgsq(DataWgWgsq dataWgWgsq,LoginUser userInfo)
    {
        dataWgWgsq.setUpdateTime(DateUtils.getNowDate());
        return dataWgWgsqMapper.updateDataWgWgsq(dataWgWgsq);
    }

    /**
     * 批量删除网格社区
     * 
     * @param ids 需要删除的网格社区ID
     * @return 结果
     */
    @Override
    public int deleteDataWgWgsqByIds(String[] ids)
    {
        return dataWgWgsqMapper.deleteDataWgWgsqByIds(ids);
    }

    /**
     * 删除网格社区信息
     * 
     * @param id 网格社区ID
     * @return 结果
     */
    @Override
    public int deleteDataWgWgsqById(String id)
    {
        return dataWgWgsqMapper.deleteDataWgWgsqById(id);
    }

    /**
     * 查询网格社区
     *
     * @param id 网格社区ID
     * @return 网格社区
     */
    @Override
    public DataWgWgsq selectDataWgWgsqById(String id)
    {
        return dataWgWgsqMapper.selectDataWgWgsqById(id);
    }
}
